package com.ylyq.ylxx.model.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @ClassName GetReportRequest
 * @Description TODO
 * @Author xiaweichao
 * @Date 2020/7/2 11:44
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "获取广告组创意的请求参数")
public class GetReportRequest {
    @ApiModelProperty(value = "广告主ID")
    @NotNull(message = "广告主ID不能为空")
    private Long advertiser_id;
    @ApiModelProperty(value = "起始日期,格式YYYY-MM-DD,只支持查询2016-10-26及以后的日期")
    @NotNull(message = "起始日期不能为空")
    private String start_date;
    @ApiModelProperty(value = "结束日期,格式YYYY-MM-DD,只支持查询2016-10-26及以后的日期\n" +
            "- 对于搜索词报表，只支持查看最近 30 天的数据;\n" +
            "- 对于关键词报表，只支持查看 2019-05-19 之后的数据")
    @NotNull(message = "结束日期不能为空")
    private String end_date;

    @ApiModelProperty(value = "页数默认值: 1")
    private Integer page;

    @ApiModelProperty(value = "页面大小默认值: 10")
    private Integer page_size;
    @ApiModelProperty(value = "分组条件：\n" +
            "对于关键词报表，组合规则如下：\n" +
            "STAT_GROUP_BY_BIDWORD_ID * [STAT_GROUP_BY_TIME_MONTH或STAT_GROUP_BY_TIME_WEEK或STAT_GROUP_BY_TIME_DAY或STAT_GROUP_BY_TIME_HOUR] * [STAT_GROUP_BY_AD_ID]。BIDWORD_ID必选，几个时间分组条件最多选一个，AD_ID可选，其他分组条件都不能选；\n" +
            "对于搜索词报表，组合规则如下：\n" +
            "STAT_GROUP_BY_AD_ID*STAT_GROUP_BY_BIDWORD_ID*STAT_GROUP_BY_QUERY*[STAT_GROUP_BY_TIME_DAY或STAT_GROUP_BY_TIME_WEEK]。AD_ID、BIDWORD_ID必选；TIME_DAY、TIME_WEEK最多选一个。\n" +
            "对于基础报表（包含受众分析维度的分组条件），组合规则如下：\n" +
            "ID 类型*时间类型* 细分-受众类型。以上各个维度最多只能选一个；受众类型必选，ID 类型和时间类型可不选；时间类型不支持STAT_GROUP_BY_TIME_HOUR，同时不支持查看当天数据。\n" +
            "对于素材报表（素材报表不支持获取当天的数据），组合规则如下：\n" +
            "STAT_GROUP_BY_MATERIAL_ID必传，可结合ID 类型*时间类型*STAT_GROUP_BY_INVENTORY。以上各个类型最多只能选一个；当同时填写ID类型与时间类型时，STAT_GROUP_BY_INVENTORY必填")
    private String[] group_by;
    @ApiModelProperty(value = "指定需要的指标名称。注意：\n" +
            "1.如果没有指定，那么只返回支持的默认指标名称；\n" +
            "2.对于不同的分组条件，支持不同的指标")
    private String[] fields;
    @ApiModelProperty(value = "排序字段，所有的统计指标均可参与排序")
    private String order_field;
    @ApiModelProperty(value = "排序方式,默认值: DESC,\n" +
            "允许值: \"ASC\", \"DESC\"")
    private String order_type;

    @ApiModelProperty(value = "后置过滤条件，即聚合之后进行过滤。")
    private PostFiltering post_filtering;

    @NoArgsConstructor
    @Data
    public static class PostFiltering {
        @ApiModelProperty(value = "按总消耗过滤")
        private CostFiltering cost;
        @ApiModelProperty(value = "\t按转化数过滤")
        private ConvertCostFiltering convert;
        @ApiModelProperty(value = "按转化成本过滤")
        private ConvertCostFiltering convert_cost;


        @NoArgsConstructor
        @Data
        public static class CostFiltering {
            @ApiModelProperty(value = "总消耗最小值")
            private Long min;
            @ApiModelProperty(value = "总消耗最大值，左开右开区间")
            private Long max;
        }
        @NoArgsConstructor
        @Data
        public static class ConvertCostFiltering {
            @ApiModelProperty(value = "按广告计划 id 过滤")
            private Long[] min;
            @ApiModelProperty(value = "按广告计划 id 过滤")
            private Long[] max;
        }
    }
    @ApiModelProperty(value = "过滤条件，如果campaign_ids不填默认按照广告主过滤，支持字段如下")
    private FilteringGetReportRequest filtering;

    @NoArgsConstructor
    @Data
    public static class FilteringGetReportRequest {

        /**
         * advertiser_id : 12312321
         * advertiser_name : test_developer
         * advertiser_role : 1
         * is_valid : true
         */
        @ApiModelProperty(value = "按广告组 id 过滤")
        private Long[] campaign_id;
        @ApiModelProperty(value = "\t按广告计划 id 过滤")
        private Long[] ad_id;
        @ApiModelProperty(value = "按creative_id过滤")
        private Long[] creative_id;
        @ApiModelProperty(value = "按照广告位置过滤，详见【附录-投放位置】")
        private String[] inventory_type;
        @ApiModelProperty(value = "按照出价方式过滤，详见【附录-计划出价类型】")
        private String[] pricing;
        @ApiModelProperty(value = "按照类型过滤，详见【附录-素材类型】")
        private String[] image_mode;
        @ApiModelProperty(value = "按照创意类型过滤，STATIC_ASSEMBLE 表示程序化创意，INTERVENE表示自定义创意")
        private String[] creative_material_mode;
        @ApiModelProperty(value = "按照广告组推广目的过滤")
        private String[] landing_type;
        @ApiModelProperty(value = "按关键词过滤")
        private String[] bidword;
        @ApiModelProperty(value = "按照素材id过滤")
        private Long[] material_id;
    }
}
